package com.amumu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.amumu.dto.TopDataDto;
import com.amumu.po.Navbar;
import com.amumu.po.TopInfo;
import com.amumu.repository.NavbarRepository;
import com.amumu.repository.TopInfoRepository;
import com.amumu.service.TopDataService;

@Service
public class TopDataServiceImpl implements TopDataService {

    @Autowired
    private TopInfoRepository topInfoRepository;
    
    @Autowired
    private NavbarRepository navbarRepository;
    
	@Override
	public TopDataDto topDataOne() {
		TopDataDto topDataDto = new TopDataDto();
		TopInfo topInfo          = topInfoRepository.findOne((long) 1);
		List<Navbar>  navbars    = navbarRepository.findAll();
		topDataDto.setTopTxt(topInfo.getTopTxt());
		topDataDto.setLogImg(topInfo.getLogImg());
		topDataDto.setRightTxt(topInfo.getRightTxt());
		topDataDto.setNavbars(navbars);
		return topDataDto;
	}

	
}
